/**
 * @title MyDialog.java
 * @package com.esun.cheetah.view.personal.bindphone
 * @description 
 * @author liugan
 * @date 2012-4-24
 * @copyright 深圳市易讯天空
 */
package com.esun.cheetah.view.custom;

import com.esun.cheetah.R;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

/**
 * @title MyDialog
 * @description 对话框
 * @author liugan
 */
public class CustomAlertDialog extends Dialog {

	private Button mButton;
	private TextView mTextView;
	private CharSequence mMessage;
	private View.OnClickListener mListener;

	/**
	 * @param context
	 * @param theme
	 */
	public CustomAlertDialog(Context context) {
		super(context, R.style.dialog);
	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dialog_alert_view);
		mButton = (Button) findViewById(R.id.btn_dialog_confirm);
		mTextView = (TextView) findViewById(R.id.tv_dialog_message);
		mButton.setOnClickListener(new View.OnClickListener() {

			@Override
			public void onClick(View v) {
				CustomAlertDialog.this.dismiss();

			}
		});
	}

	@Override
	protected void onStart() {
		mTextView.setText(mMessage);
		if (mListener != null) {
			mButton.setOnClickListener(mListener);
		}
	}

	public void setMessage(CharSequence message) {
		this.mMessage = message;
	}

	public void setOnButtonClickListener(View.OnClickListener l) {
		this.mListener = l;
	}

}
